--- %%NOBANNER%% -->
![]() | ![]() |
/*-------------------<---Start of Description-->---------------------\ | Return the current system date or datetime; | |---------------------<---End of Description-->----------------------| |--------------------------------------------------------------------| |------------<---Start of Files or Arguments Needed-->---------------| | Inputs: | | datetimeformat - the output datetime format: either a date format| | or a datetime format; | |------------------<---End of Arguments Needed-->--------------------| |--------------------------------------------------------------------| |------------------<---Start of Files Created-->---------------------| | Example: %put %now(worddate20.); | | Usage: %now(datetimeformat); | \-------------------<---End of Files Created-->---------------------*/ /* %put %now(worddate20.); */ %macro now/parmbuff; %let syspbuff=%debracket(&syspbuff); %if (%length(%sysfunc(compress(&syspbuff))) le 1) %then %do; %let syspbuff=datetime22.; %sysfunc(datetime(), &syspbuff); %end; %else %if (%index(%sysfunc(compress(%quote(%upcase(&syspbuff)))), DATETIME)) %then %sysfunc(datetime(), &syspbuff); %else %if ((%length(%sysfunc(compress(&syspbuff))) gt 1) and (not %index(%quote(%upcase(&syspbuff)), DATETIME))) %then %sysfunc(date(), &syspbuff); %mend now;